<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        body {
            background-color: whitesmoke;
        }

        .box {
            width: 400px;
            text-align: center;
            height: 400px;
            color: white;
            background-color: rgb(9, 9, 9);
            margin: 50px auto;
        }

        .box .first {
            font-size: 20px;
        }

        .box.content {
            margin-top: 200px;
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="first">

        </div>
        <div class="content">

        </div>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js"></script>
    <script>
        const box = document.querySelector('.box')
        const first = document.querySelector('.first')
        const content = document.querySelector('.content')
        // box.addEventListener('mousemove', _.throttle(mouseMove, 1000))
        let i = 0;
        function mouseMove(e) {
            i++
            content.innerHTML = `
            <h1>1s鼠标移动了${i}次</h1>
            <h2>鼠标的坐标是${e.clientX},${e.clientY}</h2>
            `
        }
        function throttle(fn, delay) {
            let timer = null;
            return function () {
                if (timer) {
                    return;
                }
                timer = setTimeout(() => {
                    fn.apply(this, arguments);
                    timer = null;
                }, delay);
            }
        }
        box.addEventListener('mousemove', throttle(mouseMove, 1000))
    </script>
</body>

</html>